//
//  CommonConfig.h
//  bus
//
//  Created by hychen on 17/3/30.
//  Copyright © 2017年 Hychen. All rights reserved.
//

#ifndef CommonConfig_h
#define CommonConfig_h

#pragma mark - 数学计算
// 弧度转角度
#define RadianToDegrees_bb(radian)  (radian * 180.0)/(M_PI)
// 角度转弧度
#define DegreesToRadian_bb(x)       (M_PI * (x) / 180.0)

#pragma mark - 文件
// 文档路径
#define Path_Document_bb                    [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]
// 缓存路径
#define Path_Cache_bb                       [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) objectAtIndex:0]
// 文件路径
#define Path_File_bb(fileName, fileType)     [[NSBundle mainBundle] pathForResource:fileName ofType:fileType]
// nib实例
#define Nib_Instance_bb(nibName)                  [[NSBundle mainBundle] loadNibNamed:nibName owner:nil options:nil].lastObject

#pragma mark - 其它
// 查询一段代码的执行时间
#define TICK_bb                     NSDate *startTime = [NSDate date]
#define TOCK_bb                     NSLog(@"Time: %f", -[startTime timeIntervalSinceNow])
/*
 * TICK_bb
 * // 你的代码
 * TOCK_bb
 */

// 存储对象
#define Standard_Defaults_bb         [NSUserDefaults standardUserDefaults]
// 弱引用
#define WeakSelf_bb                 __weak typeof(self) weakSelf = self;
// 页容量
#define PageCount_bb                20


#pragma mark - 提醒信息
#import "SVProgressHUD.h"
#define Show_ActionDisabled [SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeClear];
#define Show_ActionEnabled [SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeNone];
#define Show_NoMsg              [SVProgressHUD show];
// 普通提示
#define Show_Msg(msg)           [SVProgressHUD showWithStatus:(msg)];
// 成功提示
#define Show_Msg_Success(msg)   [SVProgressHUD showSuccessWithStatus:(msg)];
// 错误提示
#define Show_Msg_Error(msg)     [SVProgressHUD showErrorWithStatus:(msg)];
// 网络提示
#define Show_Msg_Error_Net      [SVProgressHUD showErrorWithStatus:@"网络异常，无法获取数据"];
// 隐藏提示
#define Dismiss_NoMsg           [SVProgressHUD dismiss];

#pragma mark - 属性宏
// json属性宏，代表这个属性是json数据
#define JSON_Data
// KVO属性宏，代表这个属性有监听
#define KVO_Data

#pragma mark - 代码块
typedef void(^BlockWithObject_bb)(id object);
typedef void(^BlockWithVoid_bb)(void);
typedef void(^BlockWithTwoObject_bb)(id object, id object1);


#pragma mark - 文件类型后缀
#define MP3_bb                                  @"mp3"
#define MP4_bb                                  @"mp4"
#define MOV_bb                                  @"mov"
#define JPG_bb                                  @"jpg"
#define JPEG_bb                                 @"jpeg"
#define PNG_bb                                  @"png"

#endif /* CommonConfig_h */
